package com.tyl.controller;

import com.tyl.service.Asynchronous;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/*
    @RequestMapping("/test")
    @ResponseBody
* 异步任务
* */
    @Controller
    @EnableAsync//开启异步（让用户立即得到反馈）
    public class MyController {

        @Autowired
        private Asynchronous asynchronous;
    public String test(){
        asynchronous.test();
        return "ok!";
    }
}
